package it.marco.test.security;

import it.marco.test.dm.User;
import it.marco.test.service.UserService;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserSecurityService implements UserDetailsService {
	
	private UserService /*<User, String>*/ userService;
	
	public UserDetails loadUserByUsername(String username)
			throws UsernameNotFoundException, DataAccessException {
		User a = new User();
		a.setUserId(username);
		User u = (User)userService.find(username);
		
		return u;
	}

	public UserService /*<User, String>*/ getUserService() {
		return userService;
	}

	public void setUserService(UserService /*<User, String>*/ userService) {
		this.userService = userService;
	}

}
